﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Pong
{
    public class Paddle
    {
        //Fields
        private Texture2D paddleTexture;
        private Rectangle paddleRectangle;
        private Pong pong;
        private Color color;
        private Vector2 position;
        private IPaddle iStatePaddle;

        //Properties
        public Vector2 Position
        {
            get { return this.position; }
            set { this.position = value; }
        }

        public Texture2D PaddleTexture
        {
            get { return this.paddleTexture; }
        }

        public IPaddle IStatePaddle
        {
            get { return this.iStatePaddle; }
            set { this.iStatePaddle = value; }
        }

        public Color Color
        {
            get { return this.color; }
        }


        //Constructor
        public Paddle(Pong pong, Color color, Vector2 position)
        {
            this.position = position;
            this.color = color;
            this.pong = pong;
            this.paddleTexture = pong.Content.Load<Texture2D>(@"Pictures\Paddle");
            this.paddleRectangle = new Rectangle( (int)this.position.X, (int)this.position.Y,
                this.paddleTexture.Width, this.paddleTexture.Height);
            iStatePaddle = new PaddleNoMovement(this);
        }

        //Update
        public void Update(GameTime gameTime)
        {
            this.iStatePaddle.Update(gameTime);
        }

        //Draw
        public void Draw(SpriteBatch spriteBatch)
        {
           this.iStatePaddle.Draw(spriteBatch);
        }
    }
}
